import request from '@/utils/request'

export const getGoodsDetail = (goodsId) => {
  return request.get('goods/detail', { params: { goodsId } })
}

export const getGoodsList = (obj) => {
  const {
    goodsName,
    categoryId
  } = obj
  return request.get('goods/list', {
    params: {
      sortType: 'all',
      sortPrice: 0,
      categoryId: categoryId,
      goodsName: goodsName,
      page: 1
    }
  })
}

export const getGoodsComment = (goodsId) => {
  return request.get('comment/list', {
    params: {
      scoreType: -1,
      goodsId: goodsId,
      page: 1
    }
  })
}

export const getGoodsCommentRows = (obj) => {
  const { goodsId, limit } = obj
  return request.get('comment/listRows', {
    params: {
      goodsId: goodsId,
      limit: limit
    }
  })
}

export const getGoodsCommentCount = (goodsId) => {
  return request.get('comment/total', { params: { goodsId: goodsId } })
}
